from tools.treeNode import Tree


# 后序遍历
def postorderTraversal(root):
    if not root: return []
    left = postorderTraversal(root.left)
    right = postorderTraversal(root.right)
    return left + right + [root.val]


root = Tree(10)
root.left = Tree(2)
root.left.left = Tree(4)
root.left.right = Tree(5)
root.right = Tree(3)
root.right.left = Tree(6)
root.right.right = Tree(7)
print(postorderTraversal(root))
